package com.d3works.apps.account.service.payment.invoice.payment;

import com.d3works.apps.account.db.Invoice;
import com.d3works.apps.account.db.InvoicePayment;
import com.d3works.apps.account.db.InvoiceTerm;
import com.d3works.apps.account.db.Move;
import com.d3works.apps.account.db.PaymentMode;
import com.d3works.apps.account.db.PaymentSession;
import com.d3works.apps.base.db.BankDetails;
import com.d3works.apps.base.db.Currency;
import com.d3works.exception.D3worksException;
import com.google.inject.Inject;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

public interface InvoicePaymentCreateService {

  @Inject
  public InvoicePayment createInvoicePayment(
      Invoice invoice,
      BigDecimal amount,
      LocalDate paymentDate,
      Currency currency,
      PaymentMode paymentMode,
      int typeSelect);

  public InvoicePayment createInvoicePayment(Invoice invoice, BigDecimal amount, Move paymentMove)
      throws D3worksException;

  /**
   * Create an invoice payment for the specified invoice and with the specified bank details.
   *
   * @param invoice
   * @param companyBankDetails
   * @return
   */
  public InvoicePayment createInvoicePayment(Invoice invoice, BankDetails companyBankDetails)
      throws D3worksException;

  InvoicePayment createInvoicePayment(
      Invoice invoice,
      InvoiceTerm invoiceTerm,
      PaymentMode paymentMode,
      BankDetails companyBankDetails,
      LocalDate paymentDate,
      LocalDate bankDepositDate,
      String chequeNumber);

  InvoicePayment createInvoicePayment(
      Invoice invoice,
      InvoiceTerm invoiceTerm,
      PaymentMode paymentMode,
      BankDetails companyBankDetails,
      LocalDate paymentDate,
      PaymentSession paymentSession);

  /**
   * Create an invoice payment for each invoice
   *
   * @param invoiceList
   * @param paymentMode
   * @param companyBankDetails
   * @return
   */
  public List<InvoicePayment> createMassInvoicePayment(
      List<Long> invoiceList,
      PaymentMode paymentMode,
      BankDetails companyBankDetails,
      LocalDate paymentDate,
      LocalDate bankDepositDate,
      String chequeNumber)
      throws D3worksException;

  public List<Long> getInvoiceIdsToPay(List<Long> invoiceIdList) throws D3worksException;

  InvoicePayment createInvoicePayment(
      Invoice invoice, BankDetails companyBankDetails, LocalDate paymentDate)
      throws D3worksException;
}
